<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
if(!plugin_Authorize(plugin_szname('Bingz_liaotian_password'))) {
    $plugin_title='插件未授权 - ';
    $plugin_keywords='插件未授权,';
    $plugin_description='插件未授权 - ';
    $plugin_password_name=$plugin_password_name_ts;
}else{
$plugin_title='聊天室 - ';
$plugin_keywords='聊天室,';
$plugin_description='聊天室 - ';
$management_je=plugin_szname('Bingz_liaotian_money');
$management_name=Bingz_management_name(plugin_szname('Bingz_liaotian_fangs'));
$user_czqx=$user_class->user_qx('','',$user_uid);
$act=$_GET['act'];
$fid=$_GET['fid'];
if(!$user_uid){
	 $pdid='1';
}elseif($act =='cjok'){
   $name =$_POST['name'];
   $mm =$_POST['mm'];
   if(!$name ){
   	  $pdid='2';
	 }else if($db->get_one('plugin_liaotian_class'," `name` ='$name' ",'')){
   	  $pdid='4';
	 }elseif(!Bingz_management_pd($user_uid,plugin_szname('Bingz_liaotian_fangs'),plugin_szname('Bingz_liaotian_money'))){
		  $pdid="3";
   }else if(Bingz_management($user_uid,plugin_szname('Bingz_liaotian_fangs'),'-'.plugin_szname('Bingz_liaotian_money'),'创建聊天室【'.$name.'】！')){
   	  $db->insert('plugin_liaotian_class','`id` ,`uid` ,`type` ,`lsid`,`pass` ,`logo`,`name` ,`time_a` ,`time_b`',"NULL , '$user_uid', '0', '0', '$mm', '', '$name', '$time', '$time'" );
		  $fid=$db->insert_id();
   	  $pdid='5';
   }else{
   	  $pdid='6';
   }
}elseif($act =='jcok'){
   $fid =$_GET['fid'];
   $uid=$db->get_one('plugin_liaotian_xhw'," `id` = '$fid' ",'');
   $db->update('plugin_liaotian_xhw',"type = '0'"," `id` = '$fid'");
   Bingz_message_post('0',$uid[uid],'你好！你在聊天室禁言被管理员解除！');
   $pdid='7';

}elseif($act =='bjok'){
   $fid =$_GET['fid'];
   if($user_czqx or $db->get_one('plugin_liaotian_class',"`uid` = '$user_uid' and `id` = '$fid' ",'')){
      $db->update('plugin_liaotian_class',"name = '$_POST[name]' ,content = '$_POST[content]' ,logo = '$_POST[logo]' ,pass = '$_POST[pass]' "," `id` = '$fid'");
      $pdid='8';
   }else{
   	  $pdid='9';
   }
}elseif($act =='bj'){
   $fid =$_GET['fid'];
   $uid=$db->get_one('plugin_liaotian_class'," `id` = '$fid' ",'');
   $name=$uid[name];
   $content=$uid[content];
   $logo=$uid[logo];
   $pass=$uid[pass];
}elseif($act =='hwok'){
	 $uid=$_POST[uid];
   if($_POST[sj] == '0' or $_POST[sj] > '60'){
      $taa=strtotime(date("Y-m-d H:i:s",strtotime(" +1 day")));
   }else{
      $taa=strtotime(date("Y-m-d H:i:s",strtotime(" +$_POST[sj] day")));
   }
	 if(!$db->get_one('user'," `uid` ='$uid'",'')){
      $pdid='10';
   }elseif($db->get_one('plugin_liaotian_xhw',"type = '1' and `lid` = '$fid' and `uid` ='$uid'",'')){
      $pdid='11';
   }else if($user_czqx or $db->get_one('plugin_liaotian_class',"`uid` = '$user_uid' and `id` = '$fid' ",'')){
      $db->insert('plugin_liaotian_xhw','`id` ,`lid`,`uid` ,`type` ,`time_a` ,`time_b`',"NULL ,  '$fid', '$uid','1', '$taa', '$time'");
	    Bingz_message_post('0',$uid,'你好！你在聊天室被管理员拉进小黑屋。禁言'.$_POST[sj].'天！');
	    $pdid='12';
	}else{
		  $pdid='13';
  }
}
$templatesplugin='go.htm';
}
?>